﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DLULearningNetwork.ViewModels
{
    public class PagerViewModel
    {
        public string lblFirst = "Trang đầu", lblPrev = "Trước", lblNext = "Sau", lblLast = "Trang cuối";
        public int CurrentPage { get; set; }
        public int TotalPages { get; set; }
        public int TotalItems { get; set; }
        public int ItemsPerPages { get; set; }
        public int PageSize { get; set; }
        public string Action { get; set; }
        public string ActionDisplayOnUrl { get; set; }
        public string LoadingID { get; set; }
        public string UpdateTargetID { get; set; }

        public PagerViewModel(int totalItems, int pageSize, int itemsPerPage, int currentPage, string action, string actionDisplayOnUrl,
            string loadingID, string updateTargetID)
        {
            this.CurrentPage = currentPage;            
            this.ItemsPerPages = itemsPerPage;
            this.PageSize = pageSize;
            this.Action = action;
            this.ActionDisplayOnUrl = actionDisplayOnUrl;
            this.LoadingID = loadingID;
            this.UpdateTargetID = updateTargetID;

            this.TotalPages = (totalItems % itemsPerPage == 0) ? (totalItems / itemsPerPage) : (totalItems / itemsPerPage + 1);
        }
    }
}